package net.wxxr.http.request;

import java.io.File;

import net.wxxr.http.auth.PutAuthSign;
import net.wxxr.http.engine.HttpPutUploadByteEngine;



/**
 * 上传文件，以byte方式发送数据的请求对象
 * 为了兼容以前上传方式，以byte形式发送的
 * @author yuanwenfei
 */
public class HttpPutUploadByteRequest extends HttpPostRequest {

	/** 要上传文件的全路径 */
	private String filePathName;
	/** 要上传文件 */
	private File file;
	
	public String getFilePathName() {
		return filePathName;
	}

	public void setFilePathName(String filePathName) {
		this.filePathName = filePathName;
	}

	public File getFile() {
		if(file == null) {
			if(filePathName == null || "".equals(filePathName)) {
				return null;
			}
			file = new File(filePathName);
			if(!file.exists()) {
				return null;
			}
		}
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	@Override
	protected void initHttpEngine() {
		httpEngine = new HttpPutUploadByteEngine(this);
	}
	/*protected void initAuthSign() {
		if(authSign == null) {
			authSign =  new PutAuthSign(consumer, this);
		}
	}*/

}
